package com.lakeworks.common.utils;

import com.lakeworks.common.utils.http.HttpUtils;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Data
@Component
public class BaseApi {


    private static final Logger log = LoggerFactory.getLogger(BaseApi.class);

    public String baseurl;

    public String AK;

    public String SK;


    public String getResult(String url, Object data) {
        return HttpUtils.sendRequest(AK,SK,new StringBuilder(baseurl).append(url).toString(), data);
    }

    public Map<String, Object> getTicketResult(String url, Object data) {
        return HttpUtils.sendTicketRequest(AK,SK, new StringBuilder(baseurl).append(url).toString(), data);
    }


    public String getGetResult(String url){
        return HttpUtils.sendGetRequest(AK,SK,new StringBuilder(baseurl).append(url).toString());
    }

    public Map<String,Object> getPatchResult(String url, Object data){
        return HttpUtils.sendPatchRequest(AK,SK, new StringBuilder(baseurl).append(url).toString(), data);
    }


}
